money=300
product = [{"name":"goods1","price": 32}, {"name":"goods2","price": 56}, {"name":"goods3","price" :20}, {"name":"goods4", "price":90}]
shopping_cart = []
def find_product():
    for product_name in product:
        if product_name==product["name"]:
            return product_name
        else:
            return None
def check_money(money,price):
    if money >= price:
       print("够")
    else:
        print("余额不足")
while True:
    product_name = input('请输入要购买的商品名称:')
    if product_name == 'q':
        print("退出")
        break
    found = False
    for item in product:
        if item["name"] == product_name:
            found = True
            if money >= item["price"]:
                shopping_cart.append(item)
                money -= item["price"]
                print(f"恭喜，购买成功,余额为{money}")
            else:
                print("穷鬼，钱不够!请到其他超市购买!")
            continue

    if not found:
        print("没有这个商品，别瞎弄!")
print("打印购物车商品:")
for item in shopping_cart:
    print(f"{item['name']},{item['price']}")






